package cn.iocoder.yudao.module.mqtt.controller.admin.device.vo;

import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import jakarta.validation.constraints.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;

@Schema(description = "管理后台 - IoT 设备新增/修改 Request VO")
@Data
public class DeviceSaveReqVO {

    @Schema(description = "设备 ID，主键，自增", requiredMode = Schema.RequiredMode.REQUIRED, example = "20475")
    private Long id;

    @Schema(description = "设备分组编号集合")
    private Long groupId;

    @Schema(description = "角色集合")
    private String roleIds;

    @Schema(description = "mqtt_config的ID", example = "10815")
    private Long mqttConfigId;

    @Schema(description = "报警状态", example = "1")
    private String alarmStatus;

    @Schema(description = "默认报警", example = "1")
    private String alarmDefult;

    @Schema(description = "MQTT 客户端 ID", example = "20857")
    private String mqttClientId;

    @Schema(description = "设备唯一标识符，全局唯一，用于识别设备", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotEmpty(message = "设备唯一标识符，全局唯一，用于识别设备不能为空")
    private String deviceKey;

    @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
//    @NotEmpty(message = "设备名称不能为空") // 避免更新从接口获取的数据时报错
    private String deviceName;

    @Schema(description = "上送名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
    private String countryName;

    @Schema(description = "备注设备名称", example = "李四")
    private String nickname;

    @Schema(description = "数据源", example = "1")
    private String dataSource;
    @Schema(description = "设备类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    @NotNull(message = "设备类型不能为空")
    private String deviceType;

    @Schema(description = "网关SN编号", example = "16881")
//    @NotEmpty(message = "网关ID，全局唯一，不能为空") // 避免更新从接口获取的数据时报错
    private String gatewayId;

    @Schema(description = "联网方式", example = "2")
    private String networkType;

    @Schema(description = "信号")
    private String signalStrength;

    @Schema(description = "设备状态(网关)", requiredMode = Schema.RequiredMode.REQUIRED)
    private String getewayStatus;

    @Schema(description = "设备在线(MQTT)")
    private String isOnline;

    @Schema(description = "设备详细地址")
    private String address;

    @Schema(description = "设备编号")
    private String serialNumber;

    @Schema(description = "固件版本	")
    private String firmwareVersion;

    @Schema(description = "物联网卡号(ICCID) (网关)", example = "20000")
    private String firmwareId;

    @Schema(description = "设备图片", example = "https://www.iocoder.cn")
    private String picUrl;

    @Schema(description = "地区编码", example = "30089")
    private Integer areaId;

    @Schema(description = "设备位置的经度")
    private BigDecimal longitude;

    @Schema(description = "设备位置的纬度")
    private BigDecimal latitude;

    @Schema(description = "出厂日期")
    private LocalDateTime productionDate;

    @Schema(description = "安装日期")
    private LocalDateTime installationDate;

    @Schema(description = "保修时长")
    private String warrantyPeriod;


    @Schema(description = "省")
    private String province;

    @Schema(description = "市", example = "26106")
    private String city;

    @Schema(description = "区")
    private String district;

    @Schema(description = "最后上线时间")
    private LocalDateTime onlineTime;

    @Schema(description = "最后离线时间")
    private LocalDateTime offlineTime;

    @Schema(description = "设备激活时间")
    private LocalDateTime activeTime;

    @Schema(description = "设备的 IP 地址")
    private String ip;

    @Schema(description = "设备密钥，用于设备认证，需安全存储")
    private String deviceSecret;

    @Schema(description = "MQTT 用户名", example = "张三")
    private String mqttUsername;

    @Schema(description = "MQTT 密码")
    private String mqttPassword;

    @Schema(description = "认证类型（如一机一密、动态注册）", example = "2")
    private String authType;

    @Schema(description = "设备配置，JSON 格式")
    private String config;

}